);
}
/**
* @return string Slug name for the URL to the Setting page
* (i.e. the page for setting options)
*/
protected function getSettingsSlug() {
return get_class($this) . 'Settings';
}
protected function addSettingsSubMenuPageToPluginsMenu() {
$this->requireExtraPluginFiles();
$displayName = $this->getPluginDisplayName();
add_submenu_page('plugins.php',
$displayName,
$displayName,
'manage_options',
$this->getSettingsSlug(),
array(&$this, 'settingsPage'));
}
protected function addSettingsSubMenuPageToSettingsMenu() {
$this->requireExtraPluginFiles();
$displayName = $this->getPluginDisplayName();
add_options_page($displayName,
$displayName,
'manage_options',
$this->getSettingsSlug(),
array(&$this, 'settingsPage'));
}
/**
* @param $name string name of a database table
* @return string input prefixed with the WordPress DB table prefix
* plus the prefix for this plugin (lower-cased) to avoid table name collisions.
* The plugin prefix is lower-cases as a best practice that all DB table names are lower case to
* avoid issues on some platforms
*/
protected function prefixTableName($name) {
global $wpdb;
return $wpdb->prefix . strtolower($this->prefix($name));
}
/**
* Convenience function for creating AJAX URLs.
*
* @param $actionName string the name of the ajax action registered in a call like
* add_action('wp_ajax_actionName', array(&$this, 'functionName'));
* and/or
* add_action('wp_ajax_nopriv_actionName', array(&$this, 'functionName'));
*
* If have an additional parameters to add to the Ajax call, e.g. an "id" parameter,
* you could call this function and append to the returned string like:
* $url = $this->getAjaxUrl('myaction&id=') . urlencode($id);
* or more complex:
* $url = sprintf($this->getAjaxUrl('myaction&id=%s&var2=%s&var3=%s'), urlencode($id), urlencode($var2), urlencode($var3));
*
* @return string URL that can be used in a web page to make an Ajax call to $this->functionName
*/
public function getAjaxUrl($actionName) {
return admin_url('admin-ajax.php') . '?action=' . $actionName;
}
public function registerPluginActionLinks( $actions, $plugin_file ) {
if ($this->getMainPluginFileName() == basename($plugin_file)) {
$admin_url = add_query_arg( 'tab', 'settings', WPML_Utils::get_admin_page_url() );
$settings = array('settings' => '' . __( 'Settings', 'wp-mail-logging' ) . '' );
if ( ! is_array( $actions ) ) {
$actions = [];
}
$actions = array_merge( $settings, $actions );
}
return $actions;
}
}